\(\int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx\) [191]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [C] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 11 \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=x+\frac {\cos (x)}{1+\sin (x)} \]

[Out]

x+cos(x)/(1+sin(x))

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {4476, 2814, 2727} \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=x+\frac {\cos (x)}{\sin (x)+1} \]

[In]

Int[Tan[x]/(Sec[x] + Tan[x]),x]

[Out]

x + Cos[x]/(1 + Sin[x])

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 4476

Int[(u_.)*((b_.)*sec[(c_.) + (d_.)*(x_)]^(n_.) + (a_.)*tan[(c_.) + (d_.)*(x_)]^(n_.))^(p_), x_Symbol] :> Int[A
ctivateTrig[u]*Sec[c + d*x]^(n*p)*(b + a*Sin[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\sin (x)}{1+\sin (x)} \, dx \\ & = x-\int \frac {1}{1+\sin (x)} \, dx \\ & = x+\frac {\cos (x)}{1+\sin (x)} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(25\) vs. \(2(11)=22\).

Time = 0.07 (sec) , antiderivative size = 25, normalized size of antiderivative = 2.27 \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=x-\frac {2 \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )} \]

[In]

Integrate[Tan[x]/(Sec[x] + Tan[x]),x]

[Out]

x - (2*Sin[x/2])/(Cos[x/2] + Sin[x/2])

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 0.23 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.36

method result size
risch \(x +\frac {2}{i+{\mathrm e}^{i x}}\) \(15\)
default \(\frac {2}{\tan \left (\frac {x}{2}\right )+1}+2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )\) \(19\)

[In]

int(tan(x)/(sec(x)+tan(x)),x,method=_RETURNVERBOSE)

[Out]

x+2/(I+exp(I*x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 24 vs. \(2 (11) = 22\).

Time = 0.25 (sec) , antiderivative size = 24, normalized size of antiderivative = 2.18 \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=\frac {{\left (x + 1\right )} \cos \left (x\right ) + {\left (x - 1\right )} \sin \left (x\right ) + x + 1}{\cos \left (x\right ) + \sin \left (x\right ) + 1} \]

[In]

integrate(tan(x)/(sec(x)+tan(x)),x, algorithm="fricas")

[Out]

((x + 1)*cos(x) + (x - 1)*sin(x) + x + 1)/(cos(x) + sin(x) + 1)

Sympy [F]

\[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=\int \frac {\tan {\left (x \right )}}{\tan {\left (x \right )} + \sec {\left (x \right )}}\, dx \]

[In]

integrate(tan(x)/(sec(x)+tan(x)),x)

[Out]

Integral(tan(x)/(tan(x) + sec(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 28 vs. \(2 (11) = 22\).

Time = 0.29 (sec) , antiderivative size = 28, normalized size of antiderivative = 2.55 \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=\frac {2}{\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1} + 2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(tan(x)/(sec(x)+tan(x)),x, algorithm="maxima")

[Out]

2/(sin(x)/(cos(x) + 1) + 1) + 2*arctan(sin(x)/(cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.09 \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=x + \frac {2}{\tan \left (\frac {1}{2} \, x\right ) + 1} \]

[In]

integrate(tan(x)/(sec(x)+tan(x)),x, algorithm="giac")

[Out]

x + 2/(tan(1/2*x) + 1)

Mupad [B] (verification not implemented)

Time = 22.61 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.09 \[ \int \frac {\tan (x)}{\sec (x)+\tan (x)} \, dx=x+\frac {2}{\mathrm {tan}\left (\frac {x}{2}\right )+1} \]

[In]

int(tan(x)/(tan(x) + 1/cos(x)),x)

[Out]

x + 2/(tan(x/2) + 1)